package com.wfh.easychat.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.io.File;

/**
 * @author fenghuanwang
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 将 /avatars/** 的请求映射到本地目录
        registry.addResourceHandler("/groupavata/**")
                .addResourceLocations("file:" + System.getProperty("user.dir") + File.separator + "groupavata");

    }
}